home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 04 - 1988 / 04.10 Oct 88 / MSSourcesLong / MSPROC2.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-20  |  1.6 KB  |  75 lines  |  [TEXT/EDIT]

  1. #Options +B +E -G -H +J +K +Z
  2. #asm
  3. .verbose
  4. #endasm
  5. #include "MyTools.p"
  6. #include "MS.h"
  7. //============================
  8. MSPROC2(theMSP,menuID,itemNumber,flg)
  9.     MSPtr                theMSP;
  10.     short                menuID;
  11.     short                itemNumber,flg;
  12. //=========================
  13. BEGIN_FCT
  14.     int                i;
  15.     short                allocCount,fontNum,fontSize,byteOffSet,
  16.                         *paramPtr,paramCtr,limTab[2];
  17.     short                otherMenuID;
  18.     MSHdl                otherMSH;
  19.     long                **MIVTH;
  20.     MenuHandle        otherMH;
  21.     Str255            fontName;
  22.     short                progNum=_MSPRG17;
  23.  
  24.     IF (NOT MSParsePROC(theMSP,0,limTab))
  25.     THEN
  26.         return (-3);
  27.     ELSE
  28.         allocCount=theMSP->allocCount;
  29.         byteOffSet=_MSFIXLEN+(allocCount+1)*sizeof(MenuVerb);
  30.         paramPtr=(short *)((char *)theMSP+byteOffSet);
  31.         paramCtr=*paramPtr;
  32.         if (    paramCtr LT 3)
  33.             return(_MSMIVTER-1);
  34.  
  35.         IF (itemNumber EQ NULL)
  36.         THEN
  37.             for (i=limTab[0];i LE limTab[1];i++)
  38.                 if (BitTst(&theMSP->TF,i))
  39.                     break;
  40.             itemNumber=i;
  41.         ENDIF
  42.         if (itemNumber LT limTab[0])
  43.             itemNumber=limTab[0];
  44.         if (itemNumber GT limTab[1])
  45.             itemNumber=limTab[1];
  46.  
  47.         MIVTH=theMSP->MIVTH;
  48.         fontNum=*(*MIVTH+itemNumber);
  49.         
  50.         otherMenuID=*(paramPtr+paramCtr);
  51.         if ((otherMSH=(MSHdl)GetResource(_MSMSTTYP,otherMenuID)) EQ NIL)
  52.             return (-4);
  53.         if (NOT (otherMH=(*otherMSH)->MH))
  54.             return (-4);
  55.         HLock(otherMSH);
  56.         MIVTH=(*otherMSH)->MIVTH;        
  57.         IF (NOT MSParsePROC(*otherMSH,0,limTab))
  58.         THEN
  59.             HUnlock(otherMSH);
  60.             return (_MSMIVTER-1);
  61.         ELSE
  62.             FOR (i=limTab[0];i LE limTab[1];i++)
  63.                 fontSize=*(*MIVTH+i);
  64.                 if (RealFont(fontNum,fontSize))
  65.                     SetItemStyle(otherMH,i,outlineStyle);
  66.                 else
  67.                     SetItemStyle(otherMH,i,NULL);
  68.             ENDFOR
  69.             HUnlock(otherMSH);
  70.             return (_MSMIVTOK);
  71.         ENDIF
  72.     ENDIF
  73. END_FCT
  74. main()
  75. {}